<?php

namespace app\model\iot_model;

use app\BaseModel;
use app\model\UserModel;
use think\model\relation\BelongsTo;

class IotRoomReservation extends BaseModel
{
    protected $name = 'iot_room_reservation';

    /**
     * 用户
     * @return BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(UserModel::class,'uid')->bind([
            'user_name' => 'name',
            'sex',
            'age',
            'nation',
            'phone',
            'student_status',
            'user_number',
            'department_id'
        ]);
    }

    /**
     * 功能室
     * @return BelongsTo
     */
    public function room(): BelongsTo
    {
        return $this->belongsTo(IotRoom::class,'room_id')->bind([
            'function_room_name',
            'function_room_img'
        ]);
    }
}